import Vue from 'vue'
import VueRouter from 'vue-router'

// import Layout from '@/views/layout'
import Login from '@/views/login'
import Register from '@/views/register'
import Artcate from '@/views/artcate'
import Artlist from '@/views/artlist'
import Userinfo from '@/views/userinfo'
import Useravatar from '@/views/useravatar'
import Userpwd from '@/views/userpwd'

Vue.use(VueRouter)

const routes = [
  { path: '/login', component: Login },
  { path: '/register', component: Register },
  {
    path: '/',
    component: () => import('@/views/layout'),
    redirect: '/home', // 默认显示首页的二级路由
    children: [
      {
        path: 'home',
        component: () => import('@/views/home')
      },
      {
        path: '/art-cate',
        component: Artcate
      },
      {
        path: '/art-list',
        component: Artlist
      },
      {
        path: '/user-info',
        component: Userinfo
      },
      {
        path: '/user-avatar',
        component: Useravatar
      },
      {
        path: '/user-pwd',
        component: Userpwd
      }
    ]
  }

]

const router = new VueRouter({
  routes
})

export default router
